import { request } from '@umijs/max';

/** 分页查询设备类型 GET /terminal/type/list */
export async function getTerminalTypeListByPage(params: API.QueryTerminalTypePageParams) {
  return request<API.QueryPageResp<API.TerminalType>>('/terminal/type/list', {
    method: 'GET',
    params,
  });
}

/** 新增设备类型 POST /terminal/type/add */
export async function addTerminalType(params: API.TerminalType) {
  return request<API.Resp>('/terminal/type/add', {
    method: 'POST',
    data: params,
  });
}

/** 更新设备类型 POST /terminal/type/update */
export async function updateTerminalType(params: API.TerminalType) {
  return request<API.Resp>('/terminal/type/update', {
    method: 'POST',
    data: params,
  });
}

/** 通过ID查询单条设备类型 GET /terminal/type/get/{id} */
export async function getTerminalTypeById(id: React.Key) {
  return request<API.Resp<API.TerminalType>>(`/terminal/type/get/${id}`, {
    method: 'GET',
  });
}

/** 通过ID删除单条设备类型 POST /terminal/type/delete */
export async function deleteTerminalTypeById(id: React.Key) {
  return request<API.Resp>(`/terminal/type/delete`, {
    method: 'POST',
    params: {
      id,
    },
  });
}

/** 查询设备类型下拉框列表 GET /terminal/type/select */
export async function getTerminalTypeSelect() {
  return request<API.Resp<API.TerminalTypeSelect[]>>(`/terminal/type/select`, {
    method: 'GET',
  });
}
